
import requests
import json

url = 'https://www.baidu.com/s'

headers = {
    "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
}


# get请求
# params = {
#     "wd": '故宫'
# }

# response = requests.get(url=url, params=params, headers=headers)
# response.encoding = 'utf-8'
# print(response.text)

# post 请求
urlpost = 'https://fanyi.baidu.com/sug'
data = {
    'kw': '标题'
}
response = requests.post(url=urlpost, data=data, headers=headers)

content = response.text
print(json.loads(content))